import java.lang.ref.WeakReference;

/**
 * @author 龙小虬
 * @date 2021/4/14 21:18
 */
public class Main {
    public static void main(String[] args) {
        Entity user1 = new Entity("lxq");
//        Entity user2 = user1;
//        user1=null;
//        System.out.println(user2);

        WeakReference<Entity> user2 = new WeakReference<Entity>(user1);
        user1 = null;
        System.gc();
        System.out.println(user2.get());
    }
}
